Install TFTP server on the host PC and check the settings
xmind@Ubuntu20:~$ sudo apt-get install tftpd-hpamind@Ubuntu20:~$ cat /etc/default/tftpd-hpa
# /etc/default/tftpd-hpaTFTP_USERNAME="tftp" TFTP_DIRECTORY="/srv/tftp" TFTP_ADDRESS=":69" TFTP_OPTIONS="--secure"In this environment, the server directory is /srv/tftp.
Since this directory is read-only, add "--create" to TFTP_OPTIONS (as shown below) to make it writable
xxxxxxxxxxmind@Ubuntu20:~$ sudo vi /etc/default/tftpd-hpa
# /etc/default/tftpd-hpaTFTP_USERNAME="tftp"TFTP_DIRECTORY="/srv/tftp"TFTP_ADDRESS=":69"TFTP_OPTIONS="--secure --create"
TFTP_USERNAME="tftp", which will execute with tftp permissions. The server directory has root permissions, so switch to tftp. Additionally, add write permissions to place Petalinux build result images
xxxxxxxxxxmind@Ubuntu20:~$ ls -l /srvtotal 4drwxr-xr-x 2 root nogroup 4096 Dec 8 13:11 tftpmind@Ubuntu20:~$ sudo chown -R tftp /srv/tftpmind@Ubuntu20:~$ sudo chmod 777 /srv/tftpmind@Ubuntu20:~$ ls -l /srvtotal 4drwxrwxrwx 2 tftp nogroup 4096 Dec 8 13:11 tftpThe above setting changes will be reflected by restarting the server
xxxxxxxxxxmind@Ubuntu20:~$ sudo service tftpd-hpa restartmind@Ubuntu20:~$ service tftpd-hpa status tftpd-hpa.service - LSB: HPA's tftp server Loaded: loaded (/etc/init.d/tftpd-hpa; generated) Active: active (running) since Mon 2025-08-25 13:55:37 CST; 43s ago Docs: man:systemd-sysv-generator(8) Process: 152053 ExecStart=/etc/init.d/tftpd-hpa start (code=exited, status=> Tasks: 1 (limit: 6989) Memory: 244.0K CGroup: /system.slice/tftpd-hpa.service └─152063 /usr/sbin/in.tftpd --listen --user tftp --address :69 --s>lines 1-9/9 (END)
Execute system configuration in the Petalinux project
xxxxxxxxxxmind@Ubuntu20:~/petalinux_projects/petalinux-mind$ petalinux-config
Select Image Packaging Configuration, then change the (/tftpboot) tftpboot directory to the TFTP server directory /srv/tftp. For the root filesystem type, you can choose INITRD or EXT4; here we choose EXT4.
Save and exit, then run petalinux-config -c u-boot to configure u-boot
xxxxxxxxxxmind@Ubuntu20:~/petalinux_projects/petalinux-mind$ petalinux-config -c u-bootSelect Command line interface-> Network commands->serverip variable takes precedent over DHCP server IP
Save and exit. The setup is now complete. When executing build, the build results will be placed in the TFTP server directory.
xxxxxxxxxxmind@Ubuntu20:~/petalinux_projects/petalinux-mind$ petalinux-buildmind@Ubuntu20:/$ ls /srv/tftp/BOOT.BIN config pxelinux.cfg rootfs.cpio.gz rootfs.ext4 rootfs.manifest system.bit system.dts u-boot-dtb.bin u-boot.elf vmlinux zynq_fsbl.elfboot.scr image.ub rootfs.cpio rootfs.cpio.gz.u-boot rootfs.jffs2 rootfs.tar.gz system.dtb u-boot.bin u-boot-dtb.elf uImage zImage
Follow the steps below to connect the development board to the computer. The steps are basically the same as before.
Format the SD card to FAT32 format, or keep the previous partition configuration (FAT32+EXT4) and just delete its contents.
Install the SD card into the development board
Connect to the PC (Ubuntu) using a USB cable
Connect the development board's Ethernet port to the local network
Power on the development board
Open the serial debugging assistant software to check the connected port
Start the serial terminal software on Ubuntu
In this state, there is no bootloader, and there is no output on the serial console yet. To boot via JTAG, run the following command in the Petalinux project directory on the host PC:
xxxxxxxxxx# Open Vivado environment variablesmind@Ubuntu20:~/petalinux_projects/petalinux-mind$ source /opt/pkg/Vivado/2021.1/settings64.sh# Place the hw_server process as a daemon in the backgroundmind@Ubuntu20:~/petalinux_projects/petalinux-mind$ hw_server -s tcp::3121 &
# hw_server is now openINFO: hw_server application startedINFO: Use Ctrl-C to exit hw_server application
INFO: To connect to this hw_server instance use url: TCP:Ubuntu20:3121
# Output boot logs to the serial consolemind@Ubuntu20:~/petalinux_projects/petalinux-mind$ petalinux-boot --jtag --u-boot --fpga --hw_server-url TCP:Ubuntu20:3121[INFO] Sourcing buildtoolsINFO: Launching XSDB for file download and boot.INFO: This may take a few minutes, depending on the size of your image.rlwrap: warning: your $TERM is 'xterm-256color' but rlwrap couldn't find it in the terminfo database. Expect some problems.: Inappropriate ioctl for deviceINFO: Downloading ELF file: /home/mind/petalinux_projects/petalinux-mind/images/linux/zynq_fsbl.elf to the target. INFO: Loading image: /home/mind/petalinux_projects/petalinux-mind/images/linux/system.dtb at 0x00100000 INFO: Downloading ELF file: /home/mind/petalinux_projects/petalinux-mind/images/linux/u-boot.elf to the target. INFO: SOC Silicon version is 3.1.This will output boot logs to the serial console.
xxxxxxxxxx....DHCP client bound to address 192.168.3.193 (991 ms)*** ERROR: `serverip' not setCannot autoload with TFTPGETZynq>Note: When entering petalinux-boot --jtag --u-boot --fpga --hw_server-url TCP:Ubuntu20:3121 reports an error, check:
Set the compatibility of the virtual machine's USB device to USB3.1
Open Xilinx Mind in the virtual machine to detect the JTAG interface
Configure u-boot on this serial console for TFTP boot.
xxxxxxxxxx# Get ubuntu ip in the virtual machinemind@Ubuntu20:/$ ifconfigenp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.3.157 netmask 255.255.255.0 broadcast 192.168.3.255 inet6 fe80::1c4c:bc28:1b9a:bcd2 prefixlen 64 scopeid 0x20<link> ether 08:00:27:5e:09:4c txqueuelen 1000 (Ethernet) RX packets 172349 bytes 20517061 (20.5 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 59254 bytes 71921656 (71.9 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
xxxxxxxxxx# Set the IP address of the server (host PC) on the serial consoleZynq> setenv serverip 192.168.3.157# During boot, the following will be executed:# - Obtain the board's IP address (dhcp)# - Get pxe boot settings from the server (pxe get)# - Get the image from the server and execute (pxe boot)Zynq> dhcp;pxe get;pxe boot;The setup is complete. Restart the development board, then run petalinux-boot --jtag --u-boot --fpga --hw_server-url TCP:Ubuntu20:3121 again. Linux will boot, and you can log in as before.
Since the dhcp;pxe get;pxe boot; command uses DHCP to automatically assign an IP address, which may cause failure to enter the Linux system, you can set the board's IP address at this step. Ensure that the IP addresses on both sides are the same.
xxxxxxxxxx# Set the board's IP address on the serial consoleZynq> setenv ipaddr 192.168.3.193Now you can boot Petalinux over the network using TFTP. This way, you don't need to place images on the SD card every time you customize and run petalinux-build. A power cycle of the development board is required.
However, with this method, rootfs.cpio.gz.u-boot is extracted and used every time it boots, and any edits made will not be saved after Linux starts.
If rootfs is set to be located on the ROOT partition of the SD card, the results of edits will be saved on the SD card.
This issue can be resolved using NFS (see next section):
Install the NFS server on the host PC and create a server directory. This directory can be anywhere. Here we will use /srv/nfs.
xxxxxxxxxxmind@Ubuntu20:~$ sudo apt install nfs-kernel-servermind@Ubuntu20:~$ sudo mkdir /srv/nfsmind@Ubuntu20:~$ ls -l /srv/total 8drwxr-xr-x 2 root root 4096 8月 25 10:07 nfsdrwxrwxrwx 3 tftp nogroup 4096 8月 22 16:20 tftp
Next, set the permissions for connections from NFS clients. Add the following to the end of /etc/exports.
xxxxxxxxxxmind@Ubuntu20:~$ sudo vi /etc/exports#Added content##1. /srv/nfs: NFS server directory path#2. 192.168.3.193: IP address of the client (development board)#3. In parentheses: options#/srv/nfs 192.168.3.193(rw,sync,no_root_squash,no_subtree_check)The above setting changes will take effect after restarting the server.
xxxxxxxxxxmind@Ubuntu20:~/petalinux_projects/petalinux-mind$ sudo service nfs-server restartmind@Ubuntu20:~/petalinux_projects/petalinux-mind$ service nfs-server status nfs-server.service - NFS server and services Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled) Active: active (exited) since Tue 2025-08-26 10:28:14 CST; 10s ago Process: 283269 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS) Process: 283270 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)Proceed based on the previous TFTP configuration.
Check the versions supported by the NFS server (host PC).
xxxxxxxxxxmind@Ubuntu20:~/petalinux_projects/petalinux-mind$ sudo cat /proc/fs/nfsd/versions-2 +3 +4 +4.1 +4.2Run petalinux-config, select Image Packaging Configuration, and change Root filesystem type to NFS. Change Location of NFS root directory to the NFS server directory /srv/nfs.
Save and exit, then run petalinux-config -c kernel, go to File systems -> Network File Systems and enable the following:
NFS 4.1 appears after NFS 4 is enabled, NFS 4.2 appears after NFS 4.1 is enabled.
Go to Networking support -> Networking options and enable the following options. All options are enabled by default.
Save and exit. Since the root filesystem has been changed to NFS, the boot parameters will change.
Build the device tree to see the changes: it contains information related to NFS.
xxxxxxxxxxmind@Ubuntu20:~/petalinux_projects/petalinux-mind$ petalinux-build -c device-tree[INFO] Sourcing buildtools[INFO] Building device-tree[INFO] Sourcing build environment[INFO] Generating workspace directoryINFO: bitbake virtual/dtb...NOTE: Executing TasksNOTE: Tasks Summary: Attempted 748 tasks of which 729 didn't need to be rerun and all succeeded.INFO: Successfully copied built images to tftp dir: /srv/tftp[INFO] Successfully built device-tree
mind@Ubuntu20:~/petalinux_projects/petalinux-mind$ cat components/plnx_workspace/device-tree/device-tree/system-conf.dtsi .../ { chosen { bootargs = "console=ttyPS0,115200 earlycon root=/dev/nfs nfsroot=192.168.3.157:/srv/nfs,tcp ip=dhcp rw"; stdout-path = "serial0:115200n8"; };};...
It is also necessary to specify which NFS version to use. Copy the selected content to system-user.dtsi and add the desired NFS version. Here we use version 4.2, adding nfsvers=4.2 after tcp.
xxxxxxxxxxmind@Ubuntu20:~/petalinux_projects/petalinux-mind$ vi project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi/include/ "system-conf.dtsi"/ { chosen { bootargs = "console=ttyPS0,115200 earlycon root=/dev/nfs nfsroot=192.168.3.157:/srv/nfs,tcp,nfsvers=4.2 ip=dhcp rw"; stdout-path = "serial0:115200n8"; };};
The configuration is now complete. Run petalinux-build.
Extract the rootfs to the NFS server directory.
xxxxxxxxxx$ sudo tar xf images/linux/rootfs.tar.gz -C /srv/nfs/Similarly, follow the steps in Booting Petalinux via TFTP to start the serial console via the virtual machine.
If the previous environment variable settings were saved, TFTP booting will proceed. Press any key on the serial console before the countdown below ends to stop the autoboot.
xxxxxxxxxxHit any key to stop autoboot: 0Zynq>Configure the server IP (host IP) and boot command.
xxxxxxxxxx#Set the IP address of the server (host PC) on the serial consoleZynq> setenv serverip 192.168.3.157#During boot, the following will be executed:#- Obtain the board's IP address (dhcp)#- Fetch the Fit image (image.ub) from the TFTP server and place it at 0x10000000 (tftpboot 0x10000000 image.ub)#- Specify the image (address) and boot Linux (bootm 0x10000000)Zynq> setenv bootcmd "dhcp;tftpboot 0x10000000 image.ub;bootm 0x10000000;"Configuration is complete. Restart the development board and run petalinux-boot --jtag --u-boot --fpga --hw_server-url TCP:Ubuntu20:3121. Linux will boot, and you can log in as before.
Since the rootfs is located on the host PC, any edited content will not be lost each time the board is rebooted.